﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MISAPP.Classify.DataAccess;

namespace MISAPP.Classify.Service
{
    public class Service_CFG001:MISAPP.MISInterface.iAutoComplete  //: iService
    {

        protected DA_CFG001 cfg = null;

        protected DA_CFG001 CFG
        { 
            get
            {
                if (cfg == null)
                {
                    cfg = DA_CFG001.GetInstance();
                }
                return cfg;
            }        
        }

        #region iService Members

        public System.Data.DataSet GetCriteriaData()
        {
            return CFG.GetCriteria();
        }

        public string[] GetCriteriaArray()
        {
            return CFG.GetDistinctField();
        }

        public System.Data.DataTable GetSummaryData()
        {
            throw new NotImplementedException();
        }

        public System.Data.DataTable GetDetailData()
        {
            throw new NotImplementedException();
        }

        #endregion

        public System.Data.DataTable GetGroupBy()
        {
            return CFG.GetGroupBy();
        }

        //public System.Data.DataTable GetProjectInfo(string p_id)
        //{
        //    CFG.ResetCriteria();
        //    return CFG.GetProjectInfo(p_id);
        //}

        //~Service_CFG001()
        //{
        //    using (System.IO.StreamWriter sw = new System.IO.StreamWriter(@"D:\Service_CFG001.txt"))
        //    {
        //        // Add some text to the file.
        //        sw.Write("This is the ");
        //        sw.WriteLine("header for the file.");
        //        sw.WriteLine("-------------------");
        //        // Arbitrary objects can also be written to the file.
        //        sw.Write("The date is: ");
        //        sw.WriteLine(DateTime.Now);
        //        sw.Close();
        //    }
        //}

        #region iAutoComplete Members

        public System.Data.DataTable GetAutoCompleteTable(string p_qry)
        {
            CFG.ResetCriteria();
            return CFG.GetProjectInfo(p_qry);
        }

        #endregion
    }
}
